//
//  MainMenu.h
//  MainMenu: Main class of the game
//
//  Created by Enric Vergara on 20.10.12. 
//  Copyright OWLAB 2010. All rights reserved.
// Import the interfaces

#import "Blackjack.h"
#import "MainMenu.h"
#import "SoundManager.h"


// CBlackjack implementation
@implementation CBlackjack

+(id) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	CBlackjack *layer = [CBlackjack node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super" return value
	if ((self = [super init]))
    {
       [CCMenuItemFont setFontName:@"Helvetica-BoldOblique"];
        [CCMenuItemFont setFontSize:70];
        m_Button_BackToMenu = [CCMenuItemFont itemFromString:NSLocalizedString(@"BackToMainMenu", @"")
                                                      target:self selector:@selector(menuBackToMenu:)];
		m_Button_BackToMenu.position =  CGPointMake(0, 0);
        
        
        CGSize screenSize = [[CCDirector sharedDirector] winSize];
        // create the menu using the items
        m_Menu = [CCMenu menuWithItems:m_Button_BackToMenu, nil];
        m_Menu.position = CGPointMake(screenSize.width/2, screenSize.height/2);
        [self addChild:m_Menu];
        m_Menu.visible = true;

        
		// must be enabled if you want to receive touch events!
		self.isTouchEnabled = YES;
        
        
	}
    [self scheduleUpdate];
	return self;
}


-(void) ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
    
}

-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    
}

-(void) menuBackToMenu: (id) sender
{
    [[SoundManager sharedInstance] playEffect:SOUND_BUTTON_BACK];
    //change scene
    [[CCDirector sharedDirector] replaceScene:[CMainMenu scene]];
}



//----- UPDATE STATE MACHINE---
-(void) update:(ccTime)delta
{
    //something to do....
}

// on "dealloc" you need to release all your retained objects
-(void) dealloc
{
	//[m_Button_Poker release];
	//[m_Button_BlackJack release];
	// don't forget to call "super dealloc"
	[super dealloc];
}

@end
